# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the Linux comm domain socket layer.
#
P_PWD ?= $(shell pwd)
P_KVER ?= $(shell uname -r)
P_OUTPUT = output
TARGET := comm

#本机使用
#KERNEL := /lib/modules/$(P_KVER)/build
#服务器使用
KERNEL:= /home/wangyongrui/kaoshi/phytium-kernel

#obj-$(CONFIG_COMM)    += $(TARGET).o
obj-m    += $(TARGET).o

#$(TARGET)-y            := comm_module.o

#lkrg
all:
#	$(MAKE) -C $(KERNEL) M=$(P_PWD) modules CONFIG_DEBUG_SECTION_MISMATCH=y
	$(MAKE) -C $(KERNEL) M=$(P_PWD) modules
	mkdir -p $(P_OUTPUT)
	cp $(P_PWD)/$(TARGET).ko $(P_OUTPUT)

clean:
	$(MAKE) -C $(KERNEL) M=$(P_PWD) clean
	$(RM) Module.markers modules.order
	$(RM) $(P_PWD)/src/modules/kmod/client/kmod/Module.markers
	$(RM) $(P_PWD)/src/modules/kmod/client/kmod/modules.order
	$(RM) -rf $(P_OUTPUT)


